package com.gopay.common.core.dic.manager.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.gopay.common.core.dic.dao.CpsTransInfoQueryDAO;
import com.gopay.common.core.dic.manager.CpsTransInfoQueryManager;
import com.gopay.common.domain.cps.CpsTransInfo;

/**
 * 核心处理中心 交易信息表
 * 
 * @CpsTransInfoQueryManagerImpl.java
 * @author MA HUAN
 * @2013-1-15 下午2:24:19 www.gopay.com.cn Inc.All rights reserved.
 */

@Service(value="cpsTransInfoQueryManager")
public class CpsTransInfoQueryManagerImpl implements CpsTransInfoQueryManager {
    
    @Resource(name="cpsTransInfoQueryDAO")
    private CpsTransInfoQueryDAO cpsTransInfoQueryDAO;

    @Override
    public CpsTransInfo get(Serializable id) {
        
        return cpsTransInfoQueryDAO.find(CpsTransInfo.class, id);
    }

    @Override
    public List<CpsTransInfo> get(Map<Object, Object> paraMap) {
        return cpsTransInfoQueryDAO.findByMap(paraMap);
    }

    @Override
    public List<CpsTransInfo> getAll() {
        return cpsTransInfoQueryDAO.findAll(CpsTransInfo.class);
    }
    
    @Override
    public List<CpsTransInfo> findTransInfosByIntTxnCds(String[] intTxnCds){
        StringBuilder s = new StringBuilder("from CpsTransInfo i where i.gopayIntTxnCd in (:intTxnCds)");
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("intTxnCds", intTxnCds);
        return cpsTransInfoQueryDAO.findByHql(s.toString(), param);
    }
}